FROM centos:7

MAINTAINER zhangyu <edgar.z@foxmail.com>

LABEL app="nginx"

ENV NG_VERSION=nginx-1.25.1

RUN yum update -y \
    && yum install -y gcc-c++ gcc flex bison yajl yajl-devel curl-devel curl GeoIP-devel doxygen zlib-devel pcre-devel lmdb-devel libxml2-devel ssdeep-devel lua-devel libtool autoconf automake make  openssl-devel wget  \
    && useradd -r -s /sbin/nologin nginx \
    && wget http://nginx.org/download/$NG_VERSION.tar.gz && tar xzvf $NG_VERSION.tar.gz \
    && yum clean all 
    # && wget https://github.com/openresty/headers-more-nginx-module/archive/v0.33.tar.gz && tar xzvf v0.33.tar.gz \ 

COPY headers-more-nginx-module-0.34 /tmp/headers-more-nginx-module-0.34

RUN cd  $NG_VERSION \
    && ./configure --prefix=/usr/local/nginx \
	  --user=nginx \
	  --group=nginx \
	  --with-http_stub_status_module \
	  --with-http_ssl_module \
	  --with-http_gzip_static_module \
	  --with-http_realip_module \
	  --with-file-aio  \
	  --with-http_flv_module   \
	  --with-http_v2_module --with-stream \
	  --with-http_sub_module \
	  --with-http_geoip_module \
          --add-module=/tmp/headers-more-nginx-module-0.34 \
    && make && make install \
    && rm -rf /$NG_VERSION /$NG_VERSION.tar.gz \
    && ln -s /usr/local/nginx/sbin/nginx /usr/sbin/nginx \
    && cp -rf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 

RUN  ln -sf /dev/stdout /usr/local/nginx/logs/access.log  \    
     && ln -sf /dev/stderr /usr/local/nginx/logs/error.log 


COPY keys /usr/local/nginx/keys
COPY nginx.conf /usr/local/nginx/conf/nginx.conf
COPY error.html /usr/loca/nginx/html/error/

COPY dist /usr/local/nginx/html/fengqiao-ui/

EXPOSE 80 443

CMD ["nginx","-g","daemon off;"]
